home *** CD-ROM | disk | FTP | other *** search
/ D.I.S.C. 3 / D.I.S.C. 3.adf / Sources / hertz.s next >
Text File  |  1990-03-25  |  4KB  |  185 lines

  1. *********************************************************
  2. *                            *
  3. *        Changing the Frequency,            *
  4. *                            *
  5. *            verbrochen von Level Four ASD    *
  6. *                            *
  7. *    Compare the new and the old frequency by    *
  8. *          pushing the right mouse-button    !    *
  9. *                            *
  10. * PS: change the value 'line'                *
  11. *                            *
  12. * PPS: ya have an old tv-set displaying this ???    *
  13. *   FORGET IT !!! BUY A MONITOR (Hi Snoopy,don't worry) *
  14. *                            *
  15. *    ya have a multisync-monitor ???            *
  16. *     YEAH !!! decrease 'line' and be happy !!!    *
  17. *********************************************************
  18.  
  19. line = 240            ;line MUST be LOWER than 312 !!!!!!!!
  20.                 ;240 should run on every 'normal' monitor
  21.                 ;like 1081,1084 or PHIL. 8833 etc.
  22.                 ;line 240 is equal to 64.8 Hz
  23.                 ;(32.4 Hz in this case, coz of interlace)
  24. ;Test your monitor with this formula:
  25. ;Your personal Hz = 311/line * 50 Hz
  26. ;(take lowest 'line'-value without a 'mad' screen)
  27.  
  28.     jmp    start
  29.  
  30.     org    $40000
  31.     load    $40000
  32.  
  33. start:
  34.     move.l    $80.w,oldtrap
  35.     move.l    #start2,$80.w
  36.     trap    #0
  37.     move.l    oldtrap(pc),$80.w
  38.     rts
  39.  
  40. oldtrap: dc.l 0
  41. start2:
  42.     move.w    #$2700,sr        ;sorry, but i hate to be
  43.                     ;interrupted while working
  44.     move.l    4.w,a6
  45.     lea    grafname(pc),a1
  46.     jsr    -408(a6)
  47.     move.l    d0,a1
  48.     move.l    38(a1),oldcopper
  49.     move.l    50(a1),aktcopper
  50.     jsr    -414(a6)
  51.  
  52.     move.w    $dff002,olddma
  53.     or.w    #$8000,olddma
  54.     move.w    $dff01c,oldint
  55.     or.w    #$8000,oldint
  56.  
  57.     move.w    #$7fff,$dff09a
  58.     move.w    #$7fff,$dff096
  59.  
  60.     bsr.l    prog_begin
  61.  
  62.     move.l    oldcopper(pc),$dff080
  63.  
  64.     move.w    #$7fff,$dff09a
  65.     move.w    #$7fff,$dff096
  66.  
  67.     move.l    oldcopper(pc),$dff080
  68.     move.l    oldcopper(pc),$dff084
  69.     clr.w    $dff088
  70.  
  71.     move.w    olddma(pc),$dff096
  72.     move.w    oldint(pc),$dff09a
  73.  
  74.     rte
  75.  
  76. prog_begin:
  77.     bsr.l    get_pointers    ;search for pointers to seka-screen
  78.  
  79.     move.w    #$0000,$dff02a        ;used to syncronize interlace
  80.     move.l    #clist,$dff080
  81.     clr.w    $dff088            ;set the new copperlist
  82. sync:
  83.     cmp.b    #255,$dff006        ;this is also for interlace
  84.     bne.s    sync            ;syncronisation
  85.  
  86.     move.w    #$8380,$dff096        ;copper and screen-dma
  87. mouse:
  88.     cmpi.b    #100,$dff006
  89.     bne.s    mouse
  90. mouse2:
  91.     move.l    $dff004,d0        ;read the video-beam-position
  92.     and.l    #$0001ff00,d0
  93.     cmp.l    #line*256,d0        ;did he reached our magic line ?
  94.     bne.s    mouse2            ;wait a little if he did not
  95.  
  96.     move.l    $dff004,d1        ;read it again
  97.     and.l    #$80000000,d1        ;save the interlace-bit
  98.     or.l    #$00013778,d1        ;that's where the video-beam
  99.                     ;goes (where he is forced to go)
  100.                     ;now we have to syncronize the
  101.                     ;video-beam using its HPOS.
  102.     move.b    $dff007,d0        ;read the horizontal position.
  103.     sub.b    #20,d0        ;sub because the VBEAM is too fast for us
  104.     neg.b    d0            ;after this two commands the
  105.     lsl.b    d0,d0            ;video-beam is absolutely on the
  106.                     ;same position.
  107.                 ;lsl.b d0,d0 is only used for equalize
  108.                 ;the HPOS by wasting processor time which
  109.                 ;is in this case dependened of the HPOS:
  110.                 ;move.b $dff007,d0 ... lsl.b d0,d0
  111.  
  112.     btst    #10,$dff016
  113.     beq.s    flicker        ;new-hertz mode only if the right mb
  114.                 ;is not pressed
  115.     move.l    d1,$dff02a    ;here the VBEAM gets the kick (auah!)
  116. flicker:
  117.     move.l    plane2(pc),d0        ;everything that follows is
  118.     move.w    d0,screen_pt+6        ;of lowest interest
  119.     move.w    d0,screen_pt2+6
  120.     swap    d0
  121.     move.w    d0,screen_pt+2
  122.     move.w    d0,screen_pt2+2
  123.  
  124.     move.l    plane(pc),d0
  125.     move.l    plane2(pc),plane
  126.     move.l    d0,plane2
  127.  
  128.     btst    #6,$bfe001
  129.     bne.L    mouse
  130.  
  131.     rts
  132.  
  133. get_pointers:        ;find position of the seka-screen
  134.     move.l    aktcopper(pc),a0
  135.     move.w    #$00e0,d0
  136.     bsr.l    find_cop
  137.     move.w    2(a0),d0
  138.     swap    d0
  139.     move.w    6(a0),d0
  140.     move.l    d0,plane
  141.     add.l    #80,d0
  142.     move.l    d0,plane2
  143.     rts
  144. find_cop:
  145.     cmp.w    (a0),d0
  146.     beq.s    find_cop_end
  147.     addq.w    #4,a0
  148.     bra.s    find_cop
  149. find_cop_end:
  150.     rts
  151.  
  152. plane: dc.l 0
  153. plane2: dc.l 0
  154.  
  155. grafname: dc.b "graphics.library",0
  156.     even
  157. oldcopper: dc.l 0
  158. aktcopper: dc.l 0
  159.  
  160. olddma:    dc.w 0
  161. oldint: dc.w 0
  162.  
  163. clist:
  164.     dc.l $01000000
  165.     dc.l $008e1c81,$009049c1
  166.     dc.l $0092003c,$009400d4
  167.     dc.l $01080050,$010a0050
  168.     dc.l $01040000
  169.     dc.l $01020000
  170.     dc.l $01440000,$01460000
  171.  
  172.     dc.l $01800777,$0182000c
  173.     dc.l $0807fffe
  174.     dc.l $01009204
  175. screen_pt:
  176.     dc.l $00e00000,$00e20000
  177.  
  178.     dc.l $9c07fffe
  179. screen_pt2:
  180.     dc.l $00e00000,$00e20000
  181.  
  182.     dc.l $fffffffe
  183.  
  184. End:
  185.